{% extends "layouts/layout.html" %}
{% block title %}
Your Profile
{% endblock %}
{% block content %}
  <script type="text/javascript" src="/js/users/users.js"></script>
    <h3>Your info:</h3>
    <p>Name: {{ li.first_name + ' ' + li.last_name }}</p>
    <p>Email: {{ user.email() }}</p>
    <table style="width:100%">
    <tr>
        <td style="width:128px; padding:10px;">
            {{ li.display_avatar() }}
        </td>
        <td>
            <p>Description: <textarea class="readonlyRichText" style="width: 100%;" rows="5">{{li.desc}}</textarea></p>
        </td>
    </tr>
    </table>
    <p><a href="/users/delete_user?xsrf_token={{xsrf_token}}" onclick="return confirm('Are you sure? This will delete all your messages and items.');">Click here to delete account</a></p>
    <p><a href="/users/export_data" onclick="return confirm('Are you sure? This will generate a file with all your data.');">Export All Your User Data</a></p>
    {% for partner in partners %}
      <p><a href="/users/export_user_foreign?partner_id={{partner.key().id()}}&xsrf_token={{xsrf_token}}">Transfer login to trusted partner '{{partner.name}}'</a></p>
    {% endfor %}
    <br/><br/>
    <h3>Edit Profile</h3>
    <div class="well">
    <form action="/users/update_user" enctype="multipart/form-data" method="post">
      <input type="hidden" name="xsrf_token" value="{{xsrf_token}}"/>
      <p>
			<label>First Name: *</label>
			{{ sanitizeHTML('<input type="text" id="first_name" name="first_name" value="' + li.first_name + '" />') }}
		</p>
		<p>
			<label>Last Name: *</label>
			{{ sanitizeHTML('<input type="text" id="last_name" name="last_name" value="' + li.last_name + '" />') }}
		</p>
		<p>
			<label>
				Nickname: *
				<i class="icon-info-sign info_button-right" title="Nickname" data-content="This will be displayed instead of your real name if you are marked as private"></i>
			</label>
			{{ sanitizeHTML('<input type="text" id="nickname" name="nickname" value="' + li.nickname + '"/>') }} 
		</p>
		<p>
			<label>
				Private: 
				<i class="icon-info-sign info_button-right" title="Private" data-content="This dictates whether or not visitors are able to see your real name"></i>
			</label>
			<input type="checkbox" name="private" {% if li.private %} checked="true" {% endif %} />
		</p>
		<p>
			<label>
				Avatar:
			</label>
			<span class="file-wrapper input-prepend input-append">
			  <span class="add-on"><i class="icon-picture"></i></span>
			  <input type="file" class="upload_item" name="avatar" id="photo" />
			  <span class="btn">Choose a Photo</span>
			  <span class="add-on after_photo"></span>
			</span>
		</p>
    <p><textarea name="desc" class="richtext" rows="20">{{li.desc}}</textarea></p>
	</div>
	<p><button type="submit" value="Submit" class="btn">Submit</button></p>
    </form>
{% endblock %}